import { Controller, Get, Inject } from '@nestjs/common';
import { AppService } from './app.service';
import {ListService} from './list/list.service';

@Controller()
export class AppController {
  // constructor(private readonly appService: AppService) {}
  // constructor(@Inject('ABC') private readonly appService: AppService) {}
  constructor(@Inject('ABC') private readonly appService: AppService,
     private readonly listService: ListService,         // 这里使用 listService， 当listModules中没有 exports 导出 ListService，，那么在使用时会报错找不到 ListService， 模块
    @Inject('Test') private readonly shop: string[]         // 注入的是一个值
  ) {}

  @Get()
  getHello(): string {
    return this.appService.getHello();
  }

  // @Get('list')
  // getList(): string {
  //   return this.listService.findAll;    // 报错找不到 ListService 模块
  // }

  @Get('test')
  getShop(): string[] {
    return this.shop; 
  }
}
